package UnitTest.DataStructureTest.arrayANDlistTest.doublePointTest;

import DataStructure.arrayANDlist.doublePoint.ThreeSumLikely;
import TestData.DataStructureTestData.arrayANDlistTestData.doublePointTest.ThreeSumLikelyTestData;
import org.junit.Assert;
import org.junit.Test;

/**
 * @author liujun
 * @version 1.0
 * @date 2021/07/26
 * @author—Email liujunfirst@outlook.com
 * @blogURL https://blog.csdn.net/ljfirst
 * @description 三数之和
 * 给定一个数 target，在一维数组中，找出某 3 个数相加与 target最相近。
 * 要求：
 * 如果存在这个 3 个数，返回这三个数，没有返回{Integer.MIN_VALUE,Integer.MIN_VALUE,Integer.MIN_VALUE}
 * 输入：
 * int[] demoArray01_y = {1, 100, 22, 39, 43, 58, 64, 76, 79, 85, 96, 58};
 * int target01 = 99;
 * 输出：true (1-22-76)
 */

public class ThreeSumLikelyTest extends ThreeSumLikelyTestData {

    ThreeSumLikely ts = new ThreeSumLikely();

    @Test
    public void testgetValues() {
        int[] result = ts.getValues(demoArray01, target01);
        Assert.assertArrayEquals(answer01, result);
        result = ts.getValues(demoArray01, target011);
        Assert.assertArrayEquals(answer011, result);
        result = ts.getValues(demoArray01, target012);
        Assert.assertArrayEquals(answer012, result);
        result = ts.getValues(demoArray01, target013);
        Assert.assertArrayEquals(answer013, result);
        result = ts.getValues(demoArray01, target014);
        Assert.assertArrayEquals(answer014, result);

        result = ts.getValues(demoArray02, target02);
        Assert.assertArrayEquals(answer02, result);
        result = ts.getValues(demoArray03, target03);
        Assert.assertArrayEquals(answer03, result);
    }
}
